_n The number of scaling function samples in points.
_p_o_i_n_t_s An array of scaling function samples, each of which is an (_L_O_D,
_f_u_n_c_t_i_o_n-_v_a_l_u_e) pair.
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
The detail texture extension defines three additional texture
magnification filters. These filters are selected by choosing one of the
values GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____SSSSGGGGIIIISSSS, GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____AAAALLLLPPPPHHHHAAAA____SSSSGGGGIIIISSSS, or
GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____CCCCOOOOLLLLOOOORRRR____SSSSGGGGIIIISSSS for the current 2D texture's
All three filters sample the level zero texture array exactly as it would
be sampled with filter mode GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR. All three also sample the level
zero texture array of a second texture, known as the detail texture, when
two conditions are met. The detail texture corresponding to texture
GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD is GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS. The conditions are:
1. The active texture must be GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.
2. The internal formats of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD and
GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS must have been specified identically.
3 The level 0 image of GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS must have nonzero
width and height.
4 If the internal formats of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD and
GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS are one of the dual or quad texture
storage formats as defined by SSSSGGGGIIIISSSS____tttteeeexxxxttttuuuurrrreeee____sssseeeelllleeeecccctttt, then the
corresponding texture group selection must be specified
identically.
If these conditions are not met, it is as though the magnification
texture filter was GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR. (Although querying the magnification
filter value will return the value as specified.) If they are met, the
level zero array of the detail texture is also linearly sampled, using
n = log base 2 of the width of the level zero array of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD
m = log base 2 of the height of the level zero array of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD
N = log base 2 of the width of GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS
M = log base 2 of the height of GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS
L = GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____LLLLEEEEVVVVEEEELLLL____SSSSGGGGIIIISSSS value of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD
u = s * 2**(n-L)
v = t * 2**(m-L)
i0 = floor(u - 1/2) mod 2**N
j0 = floor(v - 1/2) mod 2**M
i1 = (i0 + 1) mod 2**N
j1 = (j0 + 1) mod 2**M
A = frac(u - 1/2)
B = frac(v - 1/2)
Tdetail = (1-A) * (1-B) * detail[i0,j0] +
A * (1-B) * detail[i1,j0] +
(1-A) * B * detail[i0,j1] +
A * B * detail[i1,j1]
Note that magnification corresponds to negative values of level-of-detail
and minification corresponds to positive values. Hence _L, the value of
the GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____LLLLEEEEVVVVEEEELLLL____SSSSGGGGIIIISSSS parameter of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD, must be
negative. The absolute value of _L can be thought of as the number of
levels that separate the layer zero image of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD and the image
of GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS, which is replicated as necessary to fill
the appropriate number of texels. For example, if _L is -2, the detail
texture image is replicated as necessary in x and y to form a single
image whose dimensions are four times larger than the level zero array of
The texture value computed from the primary texture (_T_t_e_x_t_u_r_e) and the
value computed from the detail texture (_T_d_e_t_a_i_l) are combined in one of
two ways to compute the final texture value (_T). The values of _T_t_e_x_t_u_r_e,
_T_d_e_t_a_i_l, and _T are treated as though they range from 0.0 through 1.0 in
these equations.
If GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____MMMMOOOODDDDEEEE____SSSSGGGGIIIISSSS of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD is GGGGLLLL____AAAADDDDDDDD, then
where _F is a function of the level-of-detail parameter _L_O_D. In effect,
the detail texture is scaled and biased so that its range is [-1,1]. The
resulting signed value is scaled by a function of _L_O_D, added to the base
texture, and clamped to [0,1].
If GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____MMMMOOOODDDDEEEE____SSSSGGGGIIIISSSS of GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD is GGGGLLLL____MMMMOOOODDDDUUUULLLLAAAATTTTEEEE, then
T' = Ttexture * (1 + F(LOD) * (2*Tdetail-1))
T = 0 if T' < 0;
T' if 0 <= T' <= 1;
1 if T' > 1.
Here again the detail texture is scaled and biased so that its range is
[-1,1]. The resulting signed value is scaled by a function of _L_O_D and
biased by 1. This result scales the base texture, which is then clamped
to [0,1].
ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS is used to specify the scaling function _F. _t_a_r_g_e_t
must be GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD. _n specifies the number of pairs of values in
_p_o_i_n_t_s. _p_o_i_n_t_s points to an array of pairs of floating point values.
The first value of each pair specifies a value of _L_O_D, and the second
value of each pair specifies the corresponding function value. The order
in which the points are specified is not significant. The _n value pairs
in _p_o_i_n_t_s completely specify the function, replacing any previous
specification that may have existed.
The function _F is evaluated by fitting a curve through the sample points
specified in _p_o_i_n_t_s. This curve may be linear between adjacent points,
or it may be smoothed, but it will pass exactly through the points,
limited only by the resolution of the implementation. The value pair
with the lowest _L_O_D value specifies the function value _F for all values
of _L_O_D less than or equal to that pair's _L_O_D. Likewise, the value pair
with the greatest _L_O_D value specifies the function value _F for all values
of _L_O_D greater than or equal to that pair's _L_O_D.
Since negative values of _L_O_D correspond to magnification and positive
values correspond to minification, the points should have negative _L_O_D
values (although specifying a positive value does not generate an error).
For example, an _L_O_D of -4 corresponds to a magnification by a factor of
2**4, or 16. The default function points are (0,0) and (-4,1).
If the texture magnification filter is GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____SSSSGGGGIIIISSSS, then both
the color and the alpha components of _T are computed as described in the
equations above. If the filter is GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____CCCCOOOOLLLLOOOORRRR____SSSSGGGGIIIISSSS, then all
components of _T other than alpha are computed as described above, and the
alpha component of _T is computed as if the texture magnification filter
were GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR. Finally, if the filter is GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR____DDDDEEEETTTTAAAAIIIILLLL____AAAALLLLPPPPHHHHAAAA____SSSSGGGGIIIISSSS,
the alpha component of _T is computed as described in the equations above,
and all other components of _T are computed as if the texture
magnification filter were GGGGLLLL____LLLLIIIINNNNEEEEAAAARRRR.
The detail texture itself is specified by calling ffffggggllllTTTTeeeexxxxIIIImmmmaaaaggggeeee2222DDDD with
target set to GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD____SSSSGGGGIIIISSSS, level set to 0, border set to 0,
and the other parameters specified to generate the desired image.
As a general rule, avoid using detail texturing if the base texture is
not significantly larger than the detail texture; filtering artifacts can
occur under conditions of high magnification. (For example, it's not a
good idea to use a 256x256 detail texture with a 128x128 base texture.)
Instead, make the base texture larger and incorporate more high-frequency
information in the larger mipmap levels. This is more efficient than
using detail texturing and eliminates some rendering artifacts.
EEEERRRRRRRROOOORRRRSSSS
GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____EEEENNNNUUUUMMMM is generated if _t_a_r_g_e_t is not GGGGLLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____2222DDDD.
GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____VVVVAAAALLLLUUUUEEEE is generated if _n is negative.
GGGGLLLL____IIIINNNNVVVVAAAALLLLIIIIDDDD____OOOOPPPPEEEERRRRAAAATTTTIIIIOOOONNNN is generated if ffffggggllllDDDDeeeettttaaaaiiiillllTTTTeeeexxxxFFFFuuuunnnnccccSSSSGGGGIIIISSSS is executed
between the execution of ffffggggllllBBBBeeeeggggiiiinnnn and the corresponding execution of
On RealityEngine, RealityEngine2, and VTX systems detail texturing may
not be used when rendering to pixmaps.
Detail texturing acts as if the mipmap stack were extended by a number of
levels equal to the absolute value of the GGGGLLLL____DDDDEEEETTTTAAAAIIIILLLL____TTTTEEEEXXXXTTTTUUUURRRREEEE____LLLLEEEEVVVVEEEELLLL____SSSSGGGGIIIISSSS
parameter. The number of normal mipmap levels plus the number of detail
levels must not exceed the maximum number of levels that can be supported
on the hardware. For example, on InfiniteReality systems the maximum
number of levels is 15. A detail texture at level -4 could be supported
on a base texture of size 2K (that is, a base texture with 11 levels) but
not on a base texture that is larger than 2K (one with 12 or more
levels). Failure to observe this constraint causes detail textures to